| Conditions | 2 | 
| Paths | 2 | 
| Total Lines | 36 | 
| Code Lines | 22 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 1 | ||
| Bugs | 0 | Features | 0 | 
| 1 | const mqtt = require('mqtt') | 
            ||
| 5 | module.exports = (input, callback) => { | 
            ||
| 6 | let error = null,  | 
            ||
| 7 | output = []  | 
            ||
| 8 | |||
| 9 | 	validate.sourceConfiguration(input, (validatedInput, thrownError) => { | 
            ||
| 10 | input = validatedInput  | 
            ||
| 11 | error = thrownError  | 
            ||
| 12 | })clear  | 
            ||
| 
                                                                                                    
                        
                         | 
                |||
| 13 | |||
| 14 | 	if (!error) { | 
            ||
| 15 | let configurationMqtt = configuration.mqtt(input)  | 
            ||
| 16 | let client = mqtt.connect(input.source.url, configurationMqtt)  | 
            ||
| 17 | let version = 0  | 
            ||
| 18 | let topic = input.params.topics  | 
            ||
| 19 | |||
| 20 | 		client.on('connect', () => { | 
            ||
| 21 | 			client.subscribe(topic, (errorConnection) => { | 
            ||
| 22 | 				if (!errorConnection) { | 
            ||
| 23 | 					client.on('message', (topic, message) => { | 
            ||
| 24 | version = message.toString()  | 
            ||
| 25 | })  | 
            ||
| 26 | 				} else { | 
            ||
| 27 | error = errorConnection.toString()  | 
            ||
| 28 | callback(error, output)  | 
            ||
| 29 | }  | 
            ||
| 30 | })  | 
            ||
| 31 | })  | 
            ||
| 32 | |||
| 33 | 		client.on('message', function (topic, message) { | 
            ||
| 34 | 			if (message.toString() !== 'none') { | 
            ||
| 35 | 				output.push({'message': message.toString()}) | 
            ||
| 36 | }  | 
            ||
| 37 | client.end()  | 
            ||
| 38 | callback(error, output)  | 
            ||
| 39 | })  | 
            ||
| 40 | 	} else { | 
            ||
| 41 | callback(error, output)  | 
            ||
| 44 | 
This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.
To learn more about declaring variables in Javascript, see the MDN.